package org.springcloud.wisdom.amusement.controller.sys;

import org.springcloud.wisdom.amusement.bean.ResponseData;
import org.springcloud.wisdom.amusement.controller.BaseController;
import org.springcloud.wisdom.amusement.entity.AmusementNotice;
import org.springcloud.wisdom.amusement.service.IAmusementNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/sys/funnotice")
public class AmusementNoticeController extends BaseController {
    @Autowired
    IAmusementNoticeService noticeService;
//    //获取全部公告
//    @GetMapping("gets")
//    public ResponseData<Object> getAllNotice() {
//        return returnObject(noticeService.seeAllNotice());
//    }
//    //获取社团公告
//    @GetMapping("gets2")
//    public ResponseData<Object> getAllTeamNotice(Integer teamid) {
//        return returnObject(noticeService.seeTeamNotice(teamid));
//    }
//    //获取社团已发布公告分页
//    @GetMapping("gets1")
//    public ResponseData<Object> selectPubNoticePage(int pageNum, int pageSize, Integer teamid) {
//        return returnObject(noticeService.selectPubNoticePage(pageNum, pageSize, teamid));
//    }
//    //获取社团全部公告分页
//    @GetMapping("gets22")
//    public ResponseData<Object> seeTeamNoticePage(int pageNum, int pageSize, Integer teamid) {
//        return returnObject(noticeService.seeTeamNoticePage(pageNum, pageSize, teamid));
//    }

        @GetMapping("getsun")
    public ResponseData<Object> selectPubNoticePage(int pageNum, int pageSize) {
        return returnObject(noticeService.seeUnNoticePage(pageNum, pageSize));
    }

    //删除公告 后面要改逻辑删除
    @DeleteMapping("delete/{id}")
    public ResponseData<Boolean> deleteNotice(@PathVariable("id") Integer id) {
        return returnBoolean(noticeService.deleteNotice(id));
    }
    //添加公告
    @PostMapping("add")
    public ResponseData<Boolean> addNotice(AmusementNotice amusementNotice) {
        return returnBoolean(noticeService.addNotice(amusementNotice));
    }

    //改你没有加requestBody  后面出错过来改这个
    //审核通过
    @PutMapping("update")
    public ResponseData<Boolean> realAddNotice(@RequestBody AmusementNotice amusementNotice) {
        return returnBoolean(noticeService.realAddNotice(amusementNotice));
    }

    //审核不通过
    @PutMapping("update2")
    public ResponseData<Boolean> rejectNotice(@RequestBody AmusementNotice amusementNotice) {
        return returnBoolean(noticeService.rejectNotice(amusementNotice));
    }




}
